﻿// RecastCpp.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include "../RecastDll/RecastApi.cpp"

int main()
{
	Sample_SoloMesh* sample = CreateSoloMesh();
	BuildSettings buildSettings = BuildSettings();
	buildSettings.cellSize = 0.3f;
	buildSettings.cellHeight = 0.2f;
	buildSettings.agentHeight = 2.0f;
	buildSettings.agentRadius = 0.2f;
	buildSettings.agentMaxClimb = 0.9f;
	buildSettings.agentMaxSlope = 45.0f;
	buildSettings.regionMinSize = 8;
	buildSettings.regionMergeSize = 20;
	buildSettings.edgeMaxLen = 12.0f;
	buildSettings.edgeMaxError = 1.3f;
	buildSettings.vertsPerPoly = 6.0f;
	buildSettings.detailSampleDist = 6.0f;
	buildSettings.detailSampleMaxError = 1.0f;
	buildSettings.partitionType = SAMPLE_PARTITION_WATERSHED;
	SetBuildSettings(sample, buildSettings);
	bool r = LoadMeshFile(sample, "D:\\recastnavigation_share\\RecastDemo\\Bin\\Meshes\\dungeon.obj");
	bool r1 = Build(sample);
	//LoadNavMesh(sample, "D:/recast-pathfinding/Assets/demo2NavMesh.bin");

	float array1[65535];
	int count = 0;
	GetDrawNavMesh(sample, array1, &count);

	float m_spos[3]{ -41.1599998f, 6.48999977f, -49.7900009f };
	//m_spos[0] = 19;
	//m_spos[1] = 15;
	//m_spos[2] = -65;

	float m_epos[3]{ 48.2099991f, 12.3400002f, 39.3199997f };
	//m_epos[0] = 2;
	//m_epos[1] = 9;
	//m_epos[2] = -5;

	float m_straightPath[256 * 3];
	int pointCount = 0;
	int* outPointCount = &pointCount;

	FindPathFollow(sample, m_spos, m_epos, m_straightPath, outPointCount, 2);

	std::cout << "Hello World!\n";
}

// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单

// 入门使用技巧: 
//   1. 使用解决方案资源管理器窗口添加/管理文件
//   2. 使用团队资源管理器窗口连接到源代码管理
//   3. 使用输出窗口查看生成输出和其他消息
//   4. 使用错误列表窗口查看错误
//   5. 转到“项目”>“添加新项”以创建新的代码文件，或转到“项目”>“添加现有项”以将现有代码文件添加到项目
//   6. 将来，若要再次打开此项目，请转到“文件”>“打开”>“项目”并选择 .sln 文件
